package com.mz.ozy.mvp.presenter;

import android.content.Context;

import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.DynamicListBean;
import com.mz.ozy.bean.ObShopBean;
import com.mz.ozy.bean.ObShopTitleBean;
import com.mz.ozy.mvp.model.AccountSetModel;
import com.mz.ozy.mvp.model.ObShopModel;
import com.mz.ozy.mvp.view.ObShopContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import okhttp3.ResponseBody;

/**
 * @author wansong
 * @description:
 * @date :2020/9/24 16:33
 */
public class ObShopPersenter extends BasePresenterImpl<ObShopContract.View> implements ObShopContract.Persenter {

    private ObShopModel mModel;

    public ObShopPersenter() {
        mModel = new ObShopModel();
    }

    @Override
    public void getObData(Context context) {
        mModel.getObData(context)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<ObShopTitleBean>(mView) {

                    @Override
                    public void onSuccesss(ObShopTitleBean jsonObject) {
                        mView.showObData(jsonObject);
                    }
                });
    }

    @Override
    public void getListData(Context context, String page, String orderBy, String type, String content, String orderType) {
        mModel.getDataList(context,page,orderBy,type,content,orderType)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<ObShopBean>(mView) {

                    @Override
                    public void onSuccesss(ObShopBean jsonObject) {
                        mView.showListData(jsonObject);
                    }
                });
    }
}
